﻿using UnityEngine;

namespace Core
{
    public class DamageCalculator
    {
        public static void DamageBySkill(Unit caster, Unit target, SkillSystem skill)
        {
            var casterNumericComponent = caster.GetComponent<NumericComponent>();
            var targetNumericComponent = target.GetComponent<NumericComponent>();

            targetNumericComponent[NumericType.Hp] -= casterNumericComponent[NumericType.Attack];
        }

        public static void DamageBySkill(Unit caster, Unit target, Bullet bullet)
        {
            var casterNumericComponent = caster.GetComponent<NumericComponent>();
            var targetNumericComponent = target.GetComponent<NumericComponent>();
            int.TryParse(bullet.config.damageType, out var type);
            targetNumericComponent[NumericType.Hp] -= casterNumericComponent[type];
        }
    }
}